package com.example.boot05.mapper;

import com.example.boot05.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    //通过用户名作为查询条件 查询id  如果有数据User对象会有一个id属性,如果没有数据返回值为null
    @Select("SELECT password FROM userinfo WHERE username=#{username}")
    User select(String username);

    @Insert("INSERT INTO userinfo VALUES(NULL,#{username},#{password},#{nickname},#{age})")
    void insert(User user);
}
